package nekperu15739.me.persistence.dto.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import nekperu15739.me.persistence.dto.LanguageDto;
import nekperu15739.me.persistence.entities.LanguageEntity;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;

@Component
public class LanguageDtoRowMapper implements RowMapper<LanguageDto> {

    @Autowired
    private LanguageDto languageDto;

    public LanguageDto mapRow(ResultSet resultSet, int rowNum)
            throws SQLException {
        // LanguageEntity languageEntity = new LanguageEntity();
        // languageEntity.setLanguageId(resultSet.getInt("languageId"));
        // languageEntity.setLanguage(resultSet.getString("language"));
        // return languageEntity;

        languageDto.setLanguageId(resultSet.getInt("languageId"));
        languageDto.setLanguage(resultSet.getString("language"));

        return languageDto;
    }
}
